package com.aaa.marketresearch.webclient.gwt.admin.widget;

import com.aaa.marketresearch.webclient.gwt.domain.Bill;
import com.aaa.marketresearch.webclient.gwt.domain.BillContent;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;

import java.util.List;

/**
 * @author Nail
 */
public class BillView extends Composite {

    interface BillViewUiBinder extends UiBinder<Widget, BillView> {
    }

    private static BillViewUiBinder uiBinder = GWT.create(BillViewUiBinder.class);

    @UiField
    FlowPanel content;


    public BillView(Bill bill) {
        // initialize
        initWidget(uiBinder.createAndBindUi(this));

        List<BillContent> cnt =  bill.getContent();
        for (BillContent bc: cnt) {
            BillContentView bcv = new BillContentView(bc);
            content.add(bcv);
        }
    }
}
